﻿// *----------------------------------------------------------------
// Copyright (C) 2017 通通优品
// 版权所有。
// 
// 类名：ApiConfig.cs
// 功能描述：TongTongMall.MallWeb.Core
// 
// Create User：jym 2017/02/09
// 
// Edit User：UserName,EditTime
// Describe：Describe
// ----------------------------------------------------------------*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TEC.Public.Infrastructure.Config;
using TongTongMall.Configuration;
using TongTongMall.Dependecy;
using TongTongMall.Runtime.Session;
using TongTongMall.Threading;
using TEC.Public.Common;
using TongTongMall.MallWeb.Core.Instance.Config;
using TongTongMall.MallWeb.Application.Configuration.Session;

namespace TongTongMall.MallWeb.Application.Configuration.Instance
{
    public class ApiConfig
    {

        public IMallWebSession Session { get; set; }

        private readonly ISettingManager _settingManager;
        public ApiConfig(ISettingManager _settingManager)
        {
            this._settingManager = _settingManager;
        }

        /// <summary>
        /// DES加密所需的秘钥
        /// </summary>
        public string DESKey
        {
            get
            {
                return AsyncHelper.RunSync(() =>
                {
                    return _settingManager.GetSettingValueForApplicationAsync("DESKey");
                });
            }
        }

        /// <summary>
        /// 用户注册时的默认用户分组ID
        /// </summary>
        public string DefaultGroupID
        {
            get
            {
                return AsyncHelper.RunSync(() =>
                {
                    return _settingManager.GetSettingValueForTenantAsync("DefaultGroupID", Session.TenantID.Value);
                });
            }
        }

        /// <summary>
        /// 手机验证码长度
        /// </summary>
        public int PhoneVCodeLength
        {
            get
            {
                int result = 0;
                var length = AsyncHelper.RunSync(() =>
                {
                    return _settingManager.GetSettingValueForTenantAsync("PhoneVCodeLength", Session.TenantID.Value);
                });
                int.TryParse(length, out result);
                return result;
            }
        }

        /// <summary>
        /// 手机验证码最大次数
        /// </summary>
        public int PhoneVCodeMaxTimes
        {
            get
            {
                int result = 0;
                var length = AsyncHelper.RunSync(() =>
                {
                    return _settingManager.GetSettingValueForTenantAsync("PhoneVCodeMaxTimes", Session.TenantID.Value);
                });
                int.TryParse(length, out result);
                return result;
            }
        }

        /// <summary>
        /// 备用发送短信地址
        /// </summary>
        public string BackMessageUrl
        {
            get
            {
                return AsyncHelper.RunSync(() =>
                {
                    return _settingManager.GetSettingValueForTenantAsync("BackMessageUrl", Session.TenantID.Value);
                });
            }
        }

        /// <summary>
        /// 备用发送短信地址ApiKey
        /// </summary>
        public string BackMessageApiKey
        {
            get
            {
                return AsyncHelper.RunSync(() =>
                {
                    return _settingManager.GetSettingValueForTenantAsync("BackMessageApiKey", Session.TenantID.Value);
                });
            }
        }

        /// <summary>
        /// 发送短信地址
        /// </summary>
        public string MessageUrl
        {
            get
            {
                return AsyncHelper.RunSync(() =>
                {
                    return _settingManager.GetSettingValueForTenantAsync("MessageUrl", Session.TenantID.Value);
                });
            }
        }

        /// <summary>
        /// 授权服务器地址
        /// </summary>
        public string OAuthUrl
        {
            get
            {
                return AsyncHelper.RunSync(() =>
                {
                    return _settingManager.GetSettingValueForApplicationAsync("OAuthUrl");
                });
            }
        }

        /// <summary>
        /// CPID
        /// </summary>
        public string MessageCPID
        {
            get
            {
                return AsyncHelper.RunSync(() =>
                {
                    return _settingManager.GetSettingValueForTenantAsync("MessageCPID", Session.TenantID.Value);
                });
            }
        }
        /// <summary>
        /// 密码
        /// </summary>
        public string MessagePwd
        {
            get
            {
                return AsyncHelper.RunSync(() =>
                {
                    return _settingManager.GetSettingValueForTenantAsync("MessagePwd", Session.TenantID.Value);
                });
            }
        }

        /// <summary>
        /// ChannelID
        /// </summary>
        public string MessageChannelID
        {
            get
            {
                return AsyncHelper.RunSync(() =>
                {
                    return _settingManager.GetSettingValueForTenantAsync("MessageChannelID", Session.TenantID.Value);
                });
            }
        }

        /// <summary>
        /// 短信验证码模板
        /// </summary>
        public string VerCodeContent
        {
            get
            {
                return AsyncHelper.RunSync(() =>
                {
                    return _settingManager.GetSettingValueForTenantAsync("VerCodeContent", Session.TenantID.Value);
                });
            }
        }

        /// <summary>
        /// 两次发送短信验证码 最小间隔 时间 单位秒
        /// </summary>
        public int MinIintervalTime
        {
            get
            {
                int result = 0;
                var length = AsyncHelper.RunSync(() =>
                {
                    return _settingManager.GetSettingValueForTenantAsync("MinIintervalTime", Session.TenantID.Value);
                });
                int.TryParse(length, out result);
                return result;
            }
        }

        /// <summary>
        /// 连续验证最大次数
        /// </summary>
        public int MaxValidTimes
        {
            get
            {
                int result = 0;
                var length = AsyncHelper.RunSync(() =>
                {
                    return _settingManager.GetSettingValueForTenantAsync("MaxValidTimes", Session.TenantID.Value);
                });
                int.TryParse(length, out result);
                return result;
            }
        }

        /// <summary>
        /// 连续登陆错误次数
        /// </summary>
        public int MaxErrLoginTimes
        {
            get
            {
                int result = 0;
                var length = AsyncHelper.RunSync(() =>
                {
                    return _settingManager.GetSettingValueForTenantAsync("MaxErrLoginTimes", Session.TenantID.Value);
                });
                int.TryParse(length, out result);
                return result;
            }
        }

        /// <summary>
        /// 检查连续登陆错误次数的 时间段 单位 分钟
        /// </summary>
        public int ErrLoginTime
        {
            get
            {
                int result = 0;
                var length = AsyncHelper.RunSync(() =>
                {
                    return _settingManager.GetSettingValueForTenantAsync("ErrLoginTime", Session.TenantID.Value);
                });
                int.TryParse(length, out result);
                return result;
            }
        }

        /// <summary>
        /// smtp 服务器
        /// </summary>
        public string SmtpServer
        {
            get
            {
                return AsyncHelper.RunSync(() =>
                {
                    return _settingManager.GetSettingValueForTenantAsync("SmtpServer", Session.TenantID.Value);
                });
            }
        }

        /// <summary>
        /// 发送邮件用户名
        /// </summary>
        public string FromAddress
        {
            get
            {
                return AsyncHelper.RunSync(() =>
                {
                    return _settingManager.GetSettingValueForTenantAsync("FromAddress", Session.TenantID.Value);
                });
            }
        }

        /// <summary>
        /// 发送邮件密码
        /// </summary>
        public string FromPassword
        {
            get
            {
                return AsyncHelper.RunSync(() =>
                {
                    return _settingManager.GetSettingValueForTenantAsync("FromPassword", Session.TenantID.Value);
                });
            }
        }

        /// <summary>
        /// 显示名称
        /// </summary>
        public string DisplayName
        {
            get
            {
                return AsyncHelper.RunSync(() =>
                {
                    return _settingManager.GetSettingValueForTenantAsync("DisplayName", Session.TenantID.Value);
                });
            }
        }

        /// <summary>
        /// 端口号
        /// </summary>
        public int Port
        {
            get
            {
                int result = 0;
                var length = AsyncHelper.RunSync(() =>
                {
                    return _settingManager.GetSettingValueForTenantAsync("Prot", Session.TenantID.Value);
                });
                int.TryParse(length, out result);
                return result;
            }
        }

        /// <summary>
        /// 是否启用 ssl
        /// </summary>
        public bool EnableSSL
        {
            get
            {
                int result = 0;
                var length = AsyncHelper.RunSync(() =>
                {
                    return _settingManager.GetSettingValueForTenantAsync("EnableSSL", Session.TenantID.Value);
                });
                int.TryParse(length, out result);
                return result == 1;
            }
        }

        /// <summary>
        /// 邮箱验证码的内容
        /// </summary>
        public string EmailVerCodeContent
        {
            get
            {
                return AsyncHelper.RunSync(() =>
                {
                    return _settingManager.GetSettingValueForTenantAsync("EmailVerCodeContent", Session.TenantID.Value);
                });
            }
        }

        /// <summary>
        /// 邮件标题
        /// </summary>
        public string EmailTitle
        {
            get
            {
                return AsyncHelper.RunSync(() =>
                {
                    return _settingManager.GetSettingValueForTenantAsync("EmailTitle", Session.TenantID.Value);
                });
            }
        }

        /// <summary>
        /// 收货地址数量限制
        /// </summary>
        public int ReceiptAdsCountLimit
        {
            get
            {
                int result = 0;
                var length = AsyncHelper.RunSync(() =>
                {
                    return _settingManager.GetSettingValueForTenantAsync("ReceiptAdsCountLimit", Session.TenantID.Value);
                });
                int.TryParse(length, out result);
                return result;
            }
        }

        /// <summary>
        /// 手机短信一段时间内限制发送次数
        /// </summary>
        public int LimitTimes
        {
            get
            {
                int result = 0;
                var length = AsyncHelper.RunSync(() =>
                {
                    return _settingManager.GetSettingValueForTenantAsync("LimitTimes", Session.TenantID.Value);
                });
                int.TryParse(length, out result);
                return result;
            }
        }

        /// <summary>
        /// 手机短信限制发送次数 的一段时间 单位 分钟
        /// </summary>
        public int LimitTimesSomeTime
        {
            get
            {
                int result = 0;
                var length = AsyncHelper.RunSync(() =>
                {
                    return _settingManager.GetSettingValueForTenantAsync("LimitTimesSomeTime", Session.TenantID.Value);
                });
                int.TryParse(length, out result);
                return result;
            }
        }

        /// <summary>
        /// 顶级域名
        /// </summary>

        public string Domain
        {
            get
            {
                return AsyncHelper.RunSync(() =>
                {
                    return _settingManager.GetSettingValueForTenantAsync("Domain", Session.TenantID.Value);
                });
            }
        }

        /// <summary>
        /// 7牛图片服务器地址前缀
        /// </summary>
        public string Image7NiuServerUrl
        {
            get
            {
                return AsyncHelper.RunSync(() =>
                {
                    return _settingManager.GetSettingValueForTenantAsync("Image7NiuServerUrl", Session.TenantID.Value);
                });
            }
        }


        /// <summary>
        /// 拆单金额（元）
        /// </summary>
        public decimal OrderGroupMaxMoney
        {
            get
            {
                decimal result = 0;
                var length = AsyncHelper.RunSync(() =>
                {
                    return _settingManager.GetSettingValueForTenantAsync("OrderGroupMaxMoney", Session.TenantID.Value);
                });
                decimal.TryParse(length, out result);
                return result;
            }
        }


        /// <summary>
        /// 分享标题
        /// </summary>
        public string Invite_Reg_ShareTitleFormat
        {
            get
            {
                return AsyncHelper.RunSync(() =>
                {
                    return _settingManager.GetSettingValueForTenantAsync("InviteRegShareTitleFormat", Session.TenantID.Value);
                });
            }
        }

        /// <summary>
        /// 分享描述
        /// </summary>
        public string Invite_Reg_ShareDescFormat
        {
            get
            {
                return AsyncHelper.RunSync(() =>
                {
                    return _settingManager.GetSettingValueForTenantAsync("InviteRegShareDescFormat", Session.TenantID.Value);
                });
            }
        }

        /// <summary>
        /// 分享图片地址
        /// </summary>
        public string Invite_Reg_SharePicUrl
        {
            get
            {
                return AsyncHelper.RunSync(() =>
                {
                    return _settingManager.GetSettingValueForTenantAsync("InviteRegSharePicUrl", Session.TenantID.Value);
                });
            }
        }
        /// <summary>
        /// 分享链接地址
        /// </summary>
        public string Invite_Reg_UrlFormat
        {
            get
            {
                return AsyncHelper.RunSync(() =>
                {
                    return _settingManager.GetSettingValueForTenantAsync("InviteRegUrlFormat", Session.TenantID.Value);
                });
            }
        }

        /// <summary>
        /// 注册描述消息
        /// </summary>
        public string Invite_RegMsgFormat
        {
            get
            {
                return AsyncHelper.RunSync(() =>
                {
                    return _settingManager.GetSettingValueForTenantAsync("InviteRegMsgFormat", Session.TenantID.Value);
                });
            }
        }

        /// <summary>
        /// 邀请介绍信息
        /// </summary>
        public string Invite_IntroMsgFormat
        {
            get
            {
                return AsyncHelper.RunSync(() =>
                {
                    return _settingManager.GetSettingValueForTenantAsync("InviteIntroMsgFormat", Session.TenantID.Value);
                });
            }
        }
        /// <summary>
        /// 没有支付的订单自动关闭时间（单位分钟）
        /// </summary>
        public int OrderNoPayAutoCloseTime
        {
            get
            {
                return AsyncHelper.RunSync(() =>
                {
                    return _settingManager.GetSettingValueForTenantAsync("OrderNoPayAutoCloseTime", Session.TenantID.Value);
                }).ConvertTo<int>(60);
            }
        }
        /// <summary>
        /// 没有支付的订单自动通知时间（单位分钟）
        /// </summary>
        public int OrderNoPayAutoNoticeTime
        {
            get
            {
                return AsyncHelper.RunSync(() =>
                {
                    return _settingManager.GetSettingValueForTenantAsync("OrderNoPayAutoNoticeTime", Session.TenantID.Value);
                }).ConvertTo<int>(50);
            }
        }

        /// <summary>
        /// 自动确认收货时间（日）
        /// </summary>
        public int OrderAutoConfirmTime
        {
            get
            {
                return AsyncHelper.RunSync(() =>
                {
                    return _settingManager.GetSettingValueForTenantAsync("OrderAutoConfirmTime", Session.TenantID.Value);
                }).ConvertTo<int>();
            }
        }

        /// <summary>
        /// 商城名称
        /// </summary>
        public string MallName
        {
            get
            {
                return AsyncHelper.RunSync(() =>
                {
                    return _settingManager.GetSettingValueForTenantAsync("MallName", Session.TenantID.Value);
                });
            }
        }
        /// <summary>
        /// 支付成功挑战页面地址
        /// </summary>
        public string PayCallBackUrl(long? _TenantId = null)
        {


            return AsyncHelper.RunSync(() =>
            {
                return _settingManager.GetSettingValueForTenantAsync("PayCallBackUrl", _TenantId.HasValue ? _TenantId.Value : Session.TenantID.Value);
            });

        }


        public string WeChatAuthCallBackUrl
        {
            get
            {
                return AsyncHelper.RunSync(() =>
                {
                    return _settingManager.GetSettingValueForTenantAsync("WeChatAuthCallBackUrl", Session.TenantID.Value);
                });
            }
        }

        /// <summary>
        /// 注册发送邮件给管理员开关
        /// </summary>

        public bool RegSendToAdminEmailSwitchget
        {
            get
            {
                int result = 0;
                var length = AsyncHelper.RunSync(() =>
                {
                    return _settingManager.GetSettingValueForTenantAsync("RegSendToAdminEmailSwitchget", Session.TenantID.Value);
                });
                int.TryParse(length, out result);
                return result == 1;
            }
        }

        /// <summary>
        /// Admin Email
        /// </summary>
        public string RegSendToAdminEmail
        {
            get
            {
                return AsyncHelper.RunSync(() =>
                {
                    return _settingManager.GetSettingValueForTenantAsync("RegSendToAdminEmail", Session.TenantID.Value);
                });
            }
        }
        /// <summary>
        /// H5商城地址
        /// </summary>
        public string H5MallUrl
        {
            get
            {
                return AsyncHelper.RunSync(() =>
                {
                    return _settingManager.GetSettingValueForTenantAsync("H5MallUrl", Session.TenantID.Value);
                });
            }
        }

        #region 上传相关配置

        /// <summary>
        /// 上传accesstoken
        /// </summary>
        public string UploadAccessKey
        {
            get
            {
                return AsyncHelper.RunSync(() =>
                {
                    return _settingManager.GetSettingValueForTenantAsync("UploadAccessKey", Session.TenantID.Value);
                });
            }
        }
        /// <summary>
        /// 上传秘钥
        /// </summary>
        public string UploadSecretKey
        {
            get
            {
                return AsyncHelper.RunSync(() =>
                {
                    return _settingManager.GetSettingValueForTenantAsync("UploadSecretKey", Session.TenantID.Value);
                });
            }
        }

        /// <summary>
        /// 上传作用域
        /// </summary>
        public string UploadScope
        {
            get
            {
                return AsyncHelper.RunSync(() =>
                {
                    return _settingManager.GetSettingValueForTenantAsync("UploadScope", Session.TenantID.Value);
                });
            }
        }


        /// <summary>
        /// 上传回调
        /// </summary>
        public string UploadReturnUrl
        {
            get
            {
                return AsyncHelper.RunSync(() =>
                {
                    return _settingManager.GetSettingValueForTenantAsync("UploadReturnUrl", Session.TenantID.Value);
                });
            }
        }


        /// <summary>
        /// 上传内容
        /// </summary>
        public string UploadReturnBody
        {
            get
            {
                return AsyncHelper.RunSync(() =>
                {
                    return _settingManager.GetSettingValueForTenantAsync("UploadReturnBody", Session.TenantID.Value);
                });
            }
        }


        /// <summary>
        /// 上传文件大小
        /// </summary>
        public string UploadFSizeLimit
        {
            get
            {
                return AsyncHelper.RunSync(() =>
                {
                    return _settingManager.GetSettingValueForTenantAsync("UploadFSizeLimit", Session.TenantID.Value);
                });
            }
        }


        /// <summary>
        /// 上传DetectMime
        /// </summary>
        public string UploadDetectMime
        {
            get
            {
                return AsyncHelper.RunSync(() =>
                {
                    return _settingManager.GetSettingValueForTenantAsync("UploadDetectMime", Session.TenantID.Value);
                });
            }
        }

        /// <summary>
        /// 上传MimeLimit
        /// </summary>
        public string UploadMimeLimit
        {
            get
            {
                return AsyncHelper.RunSync(() =>
                {
                    return _settingManager.GetSettingValueForTenantAsync("UploadMimeLimit", Session.TenantID.Value);
                });
            }
        }

        #endregion

        //public WXPayConfig WXAppPayConfig
        //{
        //    get
        //    {
        //        return TEC.Public.Infrastructure.Config.ConfigHelper.Instance.GetConfig<WXPayAPIConfig>().AppPayConfig;

        //        //return AsyncHelper.RunSync(() =>
        //        //{
        //        //    return _settingManager.GetSettingValueForTenantAsync("WXAppPayConfig", Session.TenantID.Value);
        //        //});
        //    }

        //}

        //public WXPayConfig WXWapPayConfig
        //{
        //    get
        //    {

        //        return TEC.Public.Infrastructure.Config.ConfigHelper.Instance.GetConfig<WXPayAPIConfig>().WapPayConfig;

        //        //return AsyncHelper.RunSync(() =>
        //        //{
        //        //    return _settingManager.GetSettingValueForTenantAsync("WXWapPayConfig", Session.TenantID.Value);
        //        //});
        //    }
        //}
        //public UnionpayPayConfig UnionpayPayConfig
        //{
        //    get
        //    {

        //        return TEC.Public.Infrastructure.Config.ConfigHelper.Instance.GetConfig<UnionpayPayConfig>();

        //        //return AsyncHelper.RunSync(() =>
        //        //{
        //        //    return _settingManager.GetSettingValueForTenantAsync("UnionpayPayConfig", Session.TenantID.Value);
        //        //});
        //    }
        //}
        //public AlipayAPIConfig AlipayConfig
        //{
        //    get
        //    {
        //        return TEC.Public.Infrastructure.Config.ConfigHelper.Instance.GetConfig<AlipayAPIConfig>();

        //        //return AsyncHelper.RunSync(() =>
        //        //{
        //        //    return _settingManager.GetSettingValueForTenantAsync("AlipayAPIConfig", Session.TenantID.Value);
        //        //});
        //    }
        //}

        ///// <summary>
        ///// 申通快递查询配置信息
        ///// </summary>
        //public ShenTongQueryConfig ShenTongQueryConfig
        //{
        //    get
        //    {
        //        //return TEC.Public.Infrastructure.Config.ConfigHelper.Instance.GetConfig<ShenTongKuaidiQueryConfig>();
        //        return AsyncHelper.RunSync(() =>
        //        {
        //            return _settingManager.GetSettingValueForApplicationAsync("ShenTongQueryConfig");
        //        }).JsonDeserialize<ShenTongQueryConfig>();
        //    }
        //}
        /// <summary>
        /// 钉钉机器人Url配置信息
        /// </summary>
        public string DingTalkRobUrl
        {
            get
            {
                return AsyncHelper.RunSync(() =>
                {
                    return _settingManager.GetSettingValueForApplicationAsync("DingTalkRobUrl");
                });
            }
        }
        /// <summary>
        /// 钉钉机器人开关配置
        /// </summary>
        public bool DingTalkRobSwitch
        {
            get
            {
                int result = 0;
                var length = AsyncHelper.RunSync(() =>
                {
                    return _settingManager.GetSettingValueForApplicationAsync("DingTalkRobswitch");
                });
                int.TryParse(length, out result);
                return result == 1;
            }
        }
        /// <summary>
        /// 钉钉机器人token
        /// </summary>
        public string DingTalkRobToken
        {
            get
            {
                return AsyncHelper.RunSync(() =>
                {
                    return _settingManager.GetSettingValueForTenantAsync("DingTalkRobToken", Session.TenantID.Value);
                });
            }
        }

        /// <summary>
        /// 界面皮肤H5线下体验店URL
        /// </summary>
        public string SkinOfflineUrl
        {
            get
            {
                return AsyncHelper.RunSync(() =>
                {
                    return _settingManager.GetSettingValueForTenantAsync("SkinOfflineUrl", Session.TenantID.Value);
                });
            }
        }

        /// <summary>
        /// H5 邀请分享页面
        /// </summary>
        public string InviteGroupUrl
        {
            get
            {
                return AsyncHelper.RunSync(() =>
                {
                    return _settingManager.GetSettingValueForTenantAsync("InviteGroupUrl", Session.TenantID.Value);
                });
            }
        }
        /// <summary>
        /// 搜索过滤正则
        /// </summary>
        public string searchRegexPattern
        {
            get
            {
                return AsyncHelper.RunSync(() => _settingManager.GetSettingValueForTenantAsync("searchRegexPattern", Session.TenantID.Value));
            }
        }

        /// <summary>
        /// 核销码图片地址
        /// </summary>
        public string VerifyImageUrl
        {
            get
            {
                return AsyncHelper.RunSync(() => _settingManager.GetSettingValueForTenantAsync("VerifyImageUrl", Session.TenantID.Value));
            }
        }

        /// <summary>
        /// 核销码图片地址
        /// </summary>
        public string LogisticsUrl
        {
            get
            {
                return AsyncHelper.RunSync(() =>
                {
                    return _settingManager.GetSettingValueForApplicationAsync("LogisticsUrl");
                });
            }
        }

        /// <summary>
        /// 支付后的提示语(预售)
        /// </summary>
        public string PaysucessedPresellMsg
        {
            get
            {
                return AsyncHelper.RunSync(() =>
                {
                    return _settingManager.GetSettingValueForApplicationAsync("PaysucessedPresellMsg");
                });
            }
        }

        /// <summary>
        /// 支付后的提示语(不同仓库)
        /// </summary>
        public string PaysucessedDiffSendMsg
        {
            get
            {
                return AsyncHelper.RunSync(() =>
                {
                    return _settingManager.GetSettingValueForApplicationAsync("PaysucessedDiffSendMsg");
                });
            }
        }


        /// <summary>
        /// 物流追踪提示语
        /// </summary>
        public string LogisticsMsg
        {
            get
            {
                return AsyncHelper.RunSync(() =>
                {
                    return _settingManager.GetSettingValueForApplicationAsync("LogisticsMsg");
                });
            }
        }
        /// <summary>
        /// 尾款支付短信提醒
        /// </summary>
        public string PayFinalTimeOutMsg
        {
            get
            {
                return AsyncHelper.RunSync(() =>
                {
                    return _settingManager.GetSettingValueForApplicationAsync("PayFinalTimeOutMsg");
                });
            }
        }

        /// <summary>
        /// 用户领券中心H5地址
        /// </summary>
        public string UserPrivilegeH5Url
        {
            get
            {
                return AsyncHelper.RunSync(() =>
                {
                    return _settingManager.GetSettingValueForTenantAsync("UserPrivilegeH5Url", Session.TenantID.Value);
                });
            }
        }

        /// <summary>
        /// 优惠券分享Url地址
        /// </summary>
        public string PrivilegeCardShareH5Url
        {
            get
            {
                return AsyncHelper.RunSync(() =>
                {
                    return _settingManager.GetSettingValueForTenantAsync("PrivilegeCardShareH5Url", Session.TenantID.Value);
                });
            }
        }

        /// <summary>
        /// 配送时间范围提示
        /// </summary>
        public string DistributionInfo
        {
            get
            {
                return AsyncHelper.RunSync(() =>
                {
                    return _settingManager.GetSettingValueForTenantAsync("DistributionInfo", Session.TenantID.Value);
                });
            }
        }

        /// <summary>
        /// 配送时间范围提示
        /// </summary>
        public string NotPickInfo
        {
            get
            {
                return AsyncHelper.RunSync(() =>
                {
                    return _settingManager.GetSettingValueForTenantAsync("NotPickInfo", Session.TenantID.Value);
                });
            }
        }
    }
}
